package com.niiwoo.civet.trade.service.dubbo.loan;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.trade.enums.LoanSubmitTypeEnum;
import com.niiwoo.civet.trade.service.loan.LoanDubboService;
import com.niiwoo.civet.trade.service.local.loan.composite.LoanService;
import com.niiwoo.civet.trade.service.local.loan.composite.LoanServiceFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Collection;
import java.util.Map;

/**
 * @Author: wuke
 * @Description:
 * @Date: Created in 17:14 2018/5/15
 */
@Slf4j
@Service(version = "1.0.0", validation = "true")
public class LoanDubboServiceImpl implements LoanDubboService {
    @Autowired
    private LoanServiceFactory loanServiceFactory;

    public void returnConfirmOverTimeProcess(){
        Map<LoanSubmitTypeEnum, LoanService> loan_service_map = loanServiceFactory.getLOAN_SERVICE_MAP();
        Collection<LoanService> loanServiceColl = loan_service_map.values();
        loanServiceColl.forEach(loanService -> {
            loanService.returnConfirmOverTimeBatchProcess();
        });
    }

    public void passConfirmOverTimeProcess(){
        Map<LoanSubmitTypeEnum, LoanService> loan_service_map = loanServiceFactory.getLOAN_SERVICE_MAP();
        Collection<LoanService> loanServiceColl = loan_service_map.values();
        loanServiceColl.forEach(loanService -> {
            loanService.passConfirmOverTimeBatchProcess();
        });
    }
}
